package br.urca.controller;

import java.util.List;

import javax.inject.Inject;

import br.com.caelum.vraptor.Controller;
import br.com.caelum.vraptor.Result;
import br.urca.dao.AlunoDAO;
import br.urca.interceptor.InterceptResource;
import br.urca.model.Aluno;

@Controller
@InterceptResource
public class AlunosController {
	
	private AlunoDAO alunoDAO;
	private Result result;
	
	public AlunosController() { }
	
	public void formulario() {
		
	}
	
	@Inject
	public AlunosController(AlunoDAO alunoDAO, Result result) {
		this.alunoDAO = alunoDAO;
		this.result = result;		
	}
	
	public List<Aluno> lista() {
		return this.alunoDAO.todos();
	}
	
	public void salvar(Aluno aluno, Result result) {
		this.alunoDAO.salvar(aluno);
		//result.redirectTo(this).lista();
	}

}
